import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyVetoException;
import java.util.ListResourceBundle;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.LogRecord;

public abstract class BaseSettings implements Comparable<BaseSettings>
{
	private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
	protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
	{
		pcs.firePropertyChange(propertyName, oldValue, newValue);
	}
	public void addPropertyChangeListener(PropertyChangeListener)
	{
		pcs.addPropertyChangeListener(listener);
	}
	public void removePropertyChangeListener(PropertyChangeListener)
	{
		pcs.removePropertyChangeListener(listener);
	}
	public int compareTo(BaseSettings o)
	{
		return getName().compareto(o.getName());
	}
	protected String getName()
	{
		return " ";
	}

	public static class PropertuVetoExceptionThatNetBeansLikes extends PropertyVetoException implements Callable
	{
		public PropertyVetoExceptionThatNetBeansLikes(String mess, PropertyChangeEvent evt)
		{
			super(mess, evt);
		}
		public Object call() throws Exception
		{
			LogRecord lg = new LogRecord(Level.ALL, getMessage());
			lg.setResourceBundle(new ListResourceBundle()
			{
				protected Object[][] getContents()
				{
					return new Object[][]
					{
						{
							getMessage(), getMessage()
						}
					};
				}
			});
			return new LogRecord[] {lg};
		}
	}
}
